package cn.zane.mybatis.io;

import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;

/**
 * @author zane
 * @date 2025/01/20
 * @Description
 */
public class Resources {

    public static Reader getResourceAsReader(String fileName) throws Exception {
        InputStream inputStream = Resources.class.getClassLoader().getResourceAsStream(fileName);
        if (inputStream != null) {
            return new InputStreamReader(inputStream, "UTF-8");
        } else {
            throw new RuntimeException("文件未找到");
        }
    }

    public static Class<?> classForName(String namespace) throws ClassNotFoundException {
        return Class.forName(namespace);
    }
}
